package com.qf.springmvc.entity;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;

import java.util.Date;

/**
 * @author nk
 * @date 2022/4/29 11:18
 */
@Data
public class User {
    private Integer id;
    //json序列化的时候，单独指定的别名
    @JsonProperty("new_name")
    private String name;
    @DateTimeFormat(pattern = "yyyy/MM/dd")
    //timezone:指定时区 GMT+8 指东八区
    @JsonFormat(pattern = "yyyy/MM/dd HH:mm:ss",timezone = "GMT+8")//json序列化使用的注解
    private Date birthday;
    @JsonIgnore //排除此属性的序列化
    private Integer age;

    @JsonSerialize()
    private Double salary;
}
